#coding:utf-8
#Author Robin Wang Li xin
#Email:Luobintianya@gmail.com
#copyright: datiandou.com
from django.http import HttpRequest
from django.http import HttpResponse
from django.template import Context, loader, RequestContext
from django.template.loader import get_template
from django.shortcuts import render, get_object_or_404, render_to_response, HttpResponseRedirect
from django import http
from django.views.decorators.csrf import csrf_exempt, csrf_protect
from datiandouweb.models import DUploadFile,UserProfile,CommReg,Resume,Language,Status
from datiandouweb.forms import  FileUploadCvForm
import json
from django.core.files.uploadedfile import UploadedFile
from datiandou import settings
import uuid
import logging
import os
from django.db import transaction
from django.http import HttpResponse, HttpResponseBadRequest
logger = logging.getLogger(__name__)
from django.db.models import Q
from datiandouweb.forms import TaskForm
from datiandouweb.models import Task,Language,UserProfile

from datiandouweb import fwsutils



@csrf_exempt
def load_information(request):
    userId=request.session.get("userID")
    stateMessage=None
    if('stateMessage' in request.session):
        stateMessage = request.session.get('stateMessage')
        del request.session['stateMessage']
    return fwsutils.fws_response('infocenter/maininfomation.html',request, {'stateMessage':stateMessage})



@csrf_exempt
def my_task(request):

    userId=request.session.get("userID")
    userInfo = UserProfile.objects.get(User_id=userId)
    mytask = Task.objects.filter(User_id=userInfo)
    return fwsutils.fws_response('infocenter/mytask.html', request,{'tasks': mytask})
